//2009/08/16 17:16:29
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class TeamSplit
{
public:
    int difference(vector <int> strengths)
    {
		sort(strengths.rbegin(), strengths.rend());
		int res = 0;
		for(int i=0; i<strengths.size(); i++)
		{
			if(i%2 == 0) res += strengths[i];
			else res -= strengths[i];
		}
		return abs(res);
    }
};
